#pragma once

#include <fstream>
#include <string>
#include "IOCPSendHandle.h"

class CFileSendHandle :
	public CIOCPSendHandle
{
public:
	CFileSendHandle(void);
	~CFileSendHandle(void);

	bool Init(std::string& _fileName){
		m_strFileName = _fileName;
		m_hIfstream.open(m_strFileName.c_str(),std::ios::binary);

		m_hIfstream.seekg(0,std::ios::end);
		m_nFileSize = m_hIfstream.tellg();

		m_hIfstream.seekg(0,std::ios::beg);
		m_nCurrentPostion = 0;

		m_nCount = 0;

		return true;
	}

	void HandleConnectionRemove(CIOCPAsynServerSocket* _pServerSocket);

	void HandleSend(CIOCPAsynServerSocket* _pServerSocket) ;

private:
	int m_nCount;
	std::string m_strFileName;
	std::ifstream m_hIfstream;
	int m_nCurrentPostion;
	int m_nFileSize;
};
